package jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author oldliu
 * @since 1.0
 */
public class DBselCourse {
    public static void main(String[] args) {
        Connection con=DBUtil.getConnection();
        try {
            PreparedStatement ps = con.prepareStatement("select * from s_subject s inner join s_grade g on (s.gradeid=g.id)");
            ResultSet rs = ps.executeQuery();
            while (rs.next()){
                System.out.println(rs.getObject("id"));
            }
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
